webpackJsonp([14],{

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	var url = __webpack_require__(10);
	var template = __webpack_require__(11);
	var main = __webpack_require__(13);
	var form = __webpack_require__(20);
	var module = __webpack_require__(21);

	//模板配置
	var tplArr = [];
	var modalTpl = __webpack_require__(18);
	var orderTpl = __webpack_require__(33);
	var moduleTpl = __webpack_require__(19);
	tplArr['module'] = template.compile(moduleTpl.replace(/^\s*|\s*$/g, ""));
	tplArr['modal'] = template.compile(modalTpl.replace(/^\s*|\s*$/g, ""));
	tplArr['order'] = template.compile(orderTpl.replace(/^\s*|\s*$/g, ""));

	var order_id = main.GetQueryString("order_id");
	// var order_id = "1044";
	function orderDetail() {
	    _this = this;
	    this.main = function () {
	        main.event(this, 'tap', 'i-click');
	        this.init();
	    };
	    this.getFooter = function (type) {
	        var data = {};
	        if (!type || type == "order_detail") {
	            data = {
	                tType: "footer",
	                lbtn: "手动发货",
	                rbtn: "扫码发货",
	                lclick: "byHead",
	                rclick: "saoMa"
	            };
	            $(".wrap").append(tplArr['order'](data));
	        } else if (type == "process") {
	            data = {
	                tType: "footer",
	                active: "1",
	                dataList: [{
	                    link: url.Index,
	                    icon: "ui-icon-home",
	                    name: "首页"
	                }, {
	                    link: url.shopCar,
	                    icon: "ui-icon-cart",
	                    name: "购物车"
	                }, {
	                    link: url.Center,
	                    icon: "ui-icon-personal",
	                    name: "个人中心"
	                }]
	            };
	            $(".wrap").append(module.getModule(data, "footer"));
	        } else if (type == "refund_detail") {
	            data = {
	                tType: "footer",
	                lbtn: "同意退货",
	                rbtn: "驳回退货",
	                lclick: "",
	                rclick: ""
	            };
	            $(".wrap").append(tplArr['order'](data));
	        }
	    };
	    this.getContent = function (type) {
	        main.get(url.orderdetail + '?order_id=' + order_id, {}, function (ret) {
	            console.log(ret);
	            var res = ret.data.data;
	            var orderInfo = {
	                status: res.order_status,
	                number: res.order_sn,
	                ordertime: res.add_time,
	                // express:"顺丰快递",
	                // expnumber:"SF683793",
	                money: res.goods_amount,
	                address: res.address,
	                person: res.name,
	                phone: res.tel,
	                method: res.shipping_name,
	                time: res.shipping_time,
	                invoice: res.inv_title
	            };
	            var goodsInfo = [];
	            for (var n in res.order_goods) {
	                var good = res.order_goods[n];
	                var _data = {
	                    "id": 1,
	                    "title": good.good_name,
	                    // "attr": [],
	                    "num": good.good_sku,
	                    "spec": good.color + "," + good.cupou + "," + good.size,
	                    "quantity": good.good_number,
	                    "price": good.market_price,
	                    // 2233222
	                    "image": good.small_image
	                };
	                goodsInfo.push(_data);
	            }

	            var data = {
	                tType: 'content',
	                total: res.goods_amount,
	                discount: res.coupons,
	                money: res.order_amount,
	                good_sku: res.order_goods[0].good_sku
	            };
	            if (!type || type == "order_detail") {
	                data.username = res.order_name;
	                data.yongjin = res.money;
	            } else if (type == "process") {
	                orderInfo = {
	                    status: res.order_status,
	                    number: res.order_sn,
	                    ordertime: res.add_time,
	                    buttons: true,
	                    link1: url.goEvaluate + "?order_id=" + res.order_id + "&good_sku=" + data.good_num,
	                    name1: "去评价",
	                    link2: "",
	                    name2: "再次购买",
	                    money: res.goods_amount,
	                    address: res.address,
	                    person: res.name,
	                    phone: res.tel,
	                    method: res.shipping_name,
	                    time: res.shipping_time,
	                    invoice: res.inv_title
	                };
	                // data.button= true;
	                // data.btnname= "申请退换货";
	                // data.link= "";
	            }
	            // 粉丝订单详情
	            else if (type == 'fans_detail') {
	                    orderInfo = {
	                        status: "已签收",
	                        number: "20389948",
	                        ordertime: "2016-08-12",
	                        money: "99.00",
	                        address: "shanghai",
	                        person: "zhangsan",
	                        method: "send by store",
	                        time: "2016-09-01"
	                    };
	                    data.username = "Jessie Yang";
	                    data.yongjin = "4.95";
	                    data.back = true;
	                } else if (type == 'refund_detail') {
	                    data.username = "Jessie Yang";
	                    data.yongjin = "4.95";
	                    data.reason = "质量问题，尺寸偏小";
	                }

	            data.goods = module.ordersGoodsInfo(goodsInfo, "ordersGoodsInfo"), data.info = module.getModule(orderInfo, "orderinfo");
	            $(".content").html(tplArr['order'](data));
	        });
	    };
	    // 手动发货弹出层
	    this.byHead = function () {
	        main.get(url.orderdetail + '?order_id=' + order_id, {}, function (ret) {
	            var res = ret.data;
	            var data = {
	                tType: "showBotActionsheet",
	                postUrl: url.ordersend,
	                exp: res.express,
	                order_id: res.data.order_id,
	                click: "faHuo",
	                pay_status: res.pay_status,
	                shipping_status: res.shipping_status
	            };
	            console.log(order_id);
	            main.botActionsheet({ "content": tplArr['module'](data) });
	        });
	    };
	    // this.viewReady = function(){

	    // }
	    //扫码发货
	    this.saoMa = function () {
	        this.byHead();
	        wx.ready(function () {
	            wx.scanQRCode({
	                needResult: 1,
	                scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码，默认二者都有
	                success: function (res) {
	                    //  var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
	                    $("#head_btn").click();
	                    var resultstr = res.resultStr;
	                    var result = resultstr.split(",");
	                    $("input[name='shipping_number']").val(result[1]);
	                    //alert(result[1]);return;
	                    //var id=$("#order_id").val();
	                    // location.href="/index.php/admin/Ceshi/sel?order_id="+id+"&result="+result;
	                    //return;
	                }
	            });
	        });
	    };

	    // 手动发货
	    this.faHuo = function (ths) {
	        if (ths.attr('isSubmit') == 'false') {
	            return false;
	        }
	        form.ajaxSubmit(".orderForm", _this, ths);
	    };
	    this.formCallback = function (ret) {
	        if (ret.code == 1) {
	            window.location.href = "order-manager";
	        }
	    };
	    this.init = function () {
	        //this.getHead();
	        if (typeof _page == "undefined") this.page = "";else this.page = _page;
	        this.getFooter(this.page);
	        this.getContent(this.page);
	        //this.viewReady(); 
	    };
	    return this.main();
	};

	var orderdetail = new orderDetail();

/***/ },

/***/ 20:
/***/ function(module, exports, __webpack_require__) {

	var url = __webpack_require__(10);
	var template = __webpack_require__(12);
	var main = __webpack_require__(13);
	var modalTpl = __webpack_require__(18);

	//模板配置
	var tplArr = [];
	template.config('escape', false);
	tplArr['modal'] = template.compile(modalTpl.replace(/^\s*|\s*$/g, ""));

	//获取验证码
	function getCode(_dom, url, id) {
	  var _mobile = $('input[name="mobile"]').val();
	  var code = $('input[name="code"]').val();
	  if (_dom.text() != '获取验证码') {
	    return false;
	  }
	  if (_mobile == "") {
	    jsAlert('请输入手机号码');
	  } else if (/^1[3|4|5|7|8]\d{9}$/.test(_mobile) == false) {
	    jsAlert('手机号码格式有误');
	  } else {
	    _dom.text("校验中");
	    $.post(url, { "user_id": id, "mobile": _mobile }, function (json, textStatus) {
	      _json = json;
	      if (_json.code == 1) {
	        var tm = 60;
	        var tmr = setInterval(function () {
	          tm--;
	          if (tm > 0) {
	            _dom.text(tm + "秒");
	          } else {
	            _dom.text('获取验证码');
	            clearInterval(tmr);
	            tm = 60;
	            //_dom.attr('onclick','join.getCode()')
	          }
	        }, 1000);

	        jsAlert('验证码已发送');
	      } else if (_json.code == 2) {
	        jsAlert(_json.data);
	        _dom.text('获取验证码');
	      } else if (_json.code == 200) {
	        jsAlert(_json.data);
	        _dom.text('获取验证码');
	      }
	    }, 'json');
	  }
	}
	//弹窗
	function jsAlert(text, Fun) {
	  if (!Fun) {
	    Fun = 'm-click="modalAlertClose"';
	  }
	  var data = {
	    "type": "1",
	    "ico": 'warn',
	    "text": text,
	    "Callback": Fun
	  };
	  $('body').append(tplArr['modal'](data));
	}
	//表单数据整理
	// function ajaxSubmit_o(obj,module,but) {

	//   //var url = $(obj).attr("action") || window.location.href;
	//   var callback_name = $(obj).attr("callback");
	//   var url = $(obj).attr("action");
	//   var data = {};
	//   var ipts = {};
	//   $('input[name],textarea[name],select[name]',obj).each(function(item){
	//       var name = $(this).attr('name');
	//       var value = $(this).val();
	//       var ipt = $(this).attr('ipt');
	//       var isArray = /\[\]$/;
	//       if(isArray.test(name)){
	//           if(!data[name]){data[name]=[]}
	//           if(!ipts[name]){ipts[name]=[]}
	//           data[name].push(value);
	//           ipts[name].push(value,ipt);
	//       }else{
	//           data[name] = value;
	//           ipts[name] = [value,ipt];
	//       }
	//   });

	//   if(!yzForm(ipts)){return false;}
	//   but.attr('isSubmit','false').text('提交中...');
	//   $.ajax({
	//       url: url,
	//       type: "get",
	//       data: data,
	//       dataType: "json",
	//       success: function(ret){
	//           //if(ret.sms_success == "1"){
	//               //if(isNotEmpty(callback)) {
	//                 //_this.id = ret.success_id;
	//                 //jsConfirm('提示','请您确认所有填写的信息准确无误！',callback_name);
	//                 module[callback_name](ret);
	//               //}
	//           //}else if(ret.sms_success == "0"){
	//               //jsAlert("验证码错误");
	//           //}
	//       },
	//       error:function(ret){

	//       }
	//   });
	// }
	//表单数据整理
	function ajaxSubmit(obj, module, but) {
	  //console.info(module)
	  var but_val = but.html();
	  if (but_val == "提交中...") {
	    console.info("频次太快");
	    return false;
	  }
	  //var url = $(obj).attr("action") || window.location.href;
	  var callback_name = $(obj).attr("callback");
	  var url = $(obj).attr("action");
	  var formtype = $(obj).attr("f-type");
	  var data = {};
	  var ipts = {};
	  $('input[name],textarea[name],select[name]', obj).each(function (item) {
	    var name = $(this).attr('name');
	    var value = $(this).val();
	    var ipt = $(this).attr('ipt');
	    var isArray = /\[\]$/;
	    if (isArray.test(name)) {
	      if (!data[name]) {
	        data[name] = [];
	      }
	      if (!ipts[name]) {
	        ipts[name] = [];
	      }
	      data[name].push(value);
	      ipts[name].push(value, ipt);
	    } else {
	      data[name] = value;
	      ipts[name] = [value, ipt];
	    }
	  });

	  if ($("input[name='is_default']:checked").length == 1) {
	    data.is_default = 1;
	  } else {
	    data.is_default = 0;
	  }

	  if (!yzForm(ipts)) {
	    return false;
	  }
	  but.attr('isSubmit', 'false').html('提交中...');

	  //console.info(data)
	  data.openid = openid;
	  // $("body").html(data.serverId);
	  $.ajax({
	    url: url, //+"?openid_test=ojtKJjq93sF3dOoz4lA12MrxtcUk",
	    type: "post",
	    data: data,
	    dataType: "json",
	    success: function (ret) {
	      // console.info(ret)
	      //if(ret.sms_success == "1"){
	      //if(isNotEmpty(callback)) {
	      //_this.id = ret.success_id;
	      //jsConfirm('提示','请您确认所有填写的信息准确无误！',callback_name);
	      module[callback_name](ret);
	      but.html(but_val);
	      //}
	      //}else if(ret.sms_success == "0"){
	      //jsAlert("验证码错误");
	      //}
	    },
	    error: function (ret) {
	      but.html(but_val);
	      console.info(ret);
	    }
	  });
	}
	//方法验证
	function yzForm(data) {
	  var Ctrue = true;
	  var hour = $('select[name="sendplan_hour"]').val();
	  for (ipt in data) {
	    if (data[ipt][1] == 'true') {
	      continue;
	    }
	    switch (ipt) {

	      case 'name':
	        if (data[ipt][0] == "") {
	          isCtrue('请输入名字');return false;
	        }
	        break;

	      case 'mobile':
	        if (data[ipt][0] == "") {
	          isCtrue('请输入手机号码');return false;
	        } else if (/^1[3|4|5|7|8]\d{9}$/.test(data[ipt][0]) == false) {
	          isCtrue('手机号码格式有误');return false;
	        }
	        break;

	      case 'address':
	        if (data[ipt][0] == "") {
	          isCtrue('请输入详细地址');return false;
	        }
	        break;
	      case 'shipping_id':
	        if (data[ipt][0] == "") {
	          isCtrue('请选择物流');return false;
	        }
	        break;
	      case 'shipping_number':
	        if (data[ipt][0] == "") {
	          isCtrue('请填写物流单号');return false;
	        }
	        break;

	      // case 'is_default':
	      //    if(data[ipt][0]==""){isCtrue('请选择');return false;}
	      // break;
	    }
	  }
	  function isCtrue(text) {
	    Ctrue = false;
	    main.alert({
	      "title": "提示",
	      "content": text
	    });
	  };
	  return Ctrue;
	}

	exports.getCode = getCode;
	exports.jsAlert = jsAlert;
	exports.ajaxSubmit = ajaxSubmit;
	exports.yzForm = yzForm;

/***/ },

/***/ 33:
/***/ function(module, exports) {

	module.exports = "{{if tType== 'content'}} \n    {{if username}}\n    <div class=\"user_name pad_common\">\n   \t\t<h5>用户昵称:{{username}}</h5>\n    </div>\n    {{/if}}\n    {{if status}}{{status}}{{/if}}\n    {{if info}}{{info}}{{/if}}\n    <div class=\"ui-border-tb\">\n    {{if goods}}{{goods}}{{/if}}\n    </div>\n    {{if button}}\n     <div class=\"ui-form-item pad-t10\">\n        <a href=\"{{link}}\" class=\"ui-btn _btn\">{{btnname}}</a>\n    </div>\n    {{/if}}\n    <div class=\"order_info\">\n        <h5>商品总额：￥{{total}}</h5>\n        <h5>优惠券：￥{{discount}}</h5>\n    </div>\n    <div class=\"order_info ui-border-t text-right\">\n        <h5>实付金额：<span class=\"pink\">￥{{money}}</span></h5>\n        {{if yongjin}}<h5 class=\"ui-txt-info\">回佣金额：￥{{yongjin}}</h5>{{/if}}\n    </div>\n    {{if reason}}\n    <div class=\"order_info ui-border-t\">\n        <h5>退款原因</h5>\n        <h5 class=\"ui-txt-info\">{{reason}}</h5>\n    </div>\n    {{/if}}\n    {{if back}}\n    <div class=\"ui-btn-wrap\">  \n     \t<a href=\"javascript:;\" class=\"ui-btn-pink ui-btn-lg\">返回</a>\n    </div>\n    {{/if}}\n{{/if}}\n{{if tType == 'footer'}}\n    {{if pay_status=='2'&&shipping_status=='0'}}\n    <footer id=\"footer\" class=\"ui-footer ui-footer-stable \">\n        <ul class=\"ui-row\">\n            <li class=\"ui-col ui-col-50\" i-click=\"{{lclick}}\" id=\"head_btn\">{{lbtn}}</li>\n            <li class=\"list-pink ui-col ui-col-50\" i-click=\"{{rclick}}\">{{rbtn}}</li>\n        </ul>\n    </footer>\n    {{/if}}\n{{/if}}\n{{if tType== \"status\"}}\n<!-- 订单状态 -->\n{{/if}}"

/***/ }

});